/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wiView.graphics.UI;

import java.awt.Color;
import javax.swing.JColorChooser;
import javax.swing.JOptionPane;

/**
 *
 * @author Tien
 */
public class ViewOption extends javax.swing.JFrame {

    Color backgroundColor;
    Color eventColor;
    /**
     * Creates new form ViewOption
     */
    public ViewOption() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jOptionTabbedPane = new javax.swing.JTabbedPane();
        jGeneralTab = new javax.swing.JPanel();
        jBackgroundLabel = new javax.swing.JLabel();
        jBColorButton = new javax.swing.JButton();
        jNodeTab = new javax.swing.JPanel();
        jNormalLabel = new javax.swing.JLabel();
        jSendLabel = new javax.swing.JLabel();
        jReceiveLabel = new javax.swing.JLabel();
        jBroadcastLabel = new javax.swing.JLabel();
        jForwardLabel = new javax.swing.JLabel();
        jNormalComboBox = new javax.swing.JComboBox();
        jSendComboBox = new javax.swing.JComboBox();
        jReceiveComboBox = new javax.swing.JComboBox();
        jBroadcastComboBox = new javax.swing.JComboBox();
        jForwardComboBox = new javax.swing.JComboBox();
        jEventTab = new javax.swing.JPanel();
        jMeassageLabel = new javax.swing.JLabel();
        jColorLabel = new javax.swing.JLabel();
        jMeassageComboBox = new javax.swing.JComboBox();
        jEColorButton = new javax.swing.JButton();
        jOkButton = new javax.swing.JButton();
        jCancelButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("View Option");

        jBackgroundLabel.setText("Background");

        jBColorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/color.png"))); // NOI18N
        jBColorButton.setBorder(null);
        jBColorButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBColorButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jGeneralTabLayout = new javax.swing.GroupLayout(jGeneralTab);
        jGeneralTab.setLayout(jGeneralTabLayout);
        jGeneralTabLayout.setHorizontalGroup(
            jGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jGeneralTabLayout.createSequentialGroup()
                .addGap(88, 88, 88)
                .addComponent(jBackgroundLabel)
                .addGap(34, 34, 34)
                .addComponent(jBColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(159, Short.MAX_VALUE))
        );
        jGeneralTabLayout.setVerticalGroup(
            jGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jGeneralTabLayout.createSequentialGroup()
                .addGroup(jGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jGeneralTabLayout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(jBackgroundLabel))
                    .addGroup(jGeneralTabLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(jBColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(144, Short.MAX_VALUE))
        );

        jOptionTabbedPane.addTab("General", jGeneralTab);

        jNormalLabel.setText("Normal");

        jSendLabel.setText("Send");

        jReceiveLabel.setText("Receive");

        jBroadcastLabel.setText("Broadcast");

        jForwardLabel.setText("Forward");

        jNormalComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jSendComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jReceiveComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jBroadcastComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jForwardComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout jNodeTabLayout = new javax.swing.GroupLayout(jNodeTab);
        jNodeTab.setLayout(jNodeTabLayout);
        jNodeTabLayout.setHorizontalGroup(
            jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jNodeTabLayout.createSequentialGroup()
                .addGap(67, 67, 67)
                .addGroup(jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jNodeTabLayout.createSequentialGroup()
                        .addComponent(jForwardLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jForwardComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jNodeTabLayout.createSequentialGroup()
                        .addComponent(jBroadcastLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jBroadcastComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jNodeTabLayout.createSequentialGroup()
                        .addComponent(jReceiveLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jReceiveComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jNodeTabLayout.createSequentialGroup()
                        .addComponent(jSendLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jSendComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jNodeTabLayout.createSequentialGroup()
                        .addComponent(jNormalLabel)
                        .addGap(86, 86, 86)
                        .addComponent(jNormalComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(153, Short.MAX_VALUE))
        );
        jNodeTabLayout.setVerticalGroup(
            jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jNodeTabLayout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jNormalLabel)
                    .addComponent(jNormalComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jSendLabel)
                    .addComponent(jSendComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jReceiveLabel)
                    .addComponent(jReceiveComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBroadcastLabel)
                    .addComponent(jBroadcastComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jNodeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jForwardLabel)
                    .addComponent(jForwardComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(66, Short.MAX_VALUE))
        );

        jOptionTabbedPane.addTab("Node", jNodeTab);

        jMeassageLabel.setText("Meassage");

        jColorLabel.setText("Color");

        jMeassageComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jEColorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/color.png"))); // NOI18N
        jEColorButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jEColorButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jEventTabLayout = new javax.swing.GroupLayout(jEventTab);
        jEventTab.setLayout(jEventTabLayout);
        jEventTabLayout.setHorizontalGroup(
            jEventTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jEventTabLayout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addGroup(jEventTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jMeassageLabel)
                    .addComponent(jColorLabel))
                .addGap(86, 86, 86)
                .addGroup(jEventTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jMeassageComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jEColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap(135, Short.MAX_VALUE))
        );
        jEventTabLayout.setVerticalGroup(
            jEventTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jEventTabLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(jEventTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jMeassageLabel)
                    .addComponent(jMeassageComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jEventTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jEventTabLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jEColorButton))
                    .addGroup(jEventTabLayout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addComponent(jColorLabel)))
                .addContainerGap(124, Short.MAX_VALUE))
        );

        jOptionTabbedPane.addTab("Event", jEventTab);

        jOkButton.setText("OK");
        jOkButton.setToolTipText("");
        jOkButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jOkButtonActionPerformed(evt);
            }
        });

        jCancelButton.setText("Cancel");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jOptionTabbedPane)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jOkButton)
                .addGap(27, 27, 27)
                .addComponent(jCancelButton)
                .addGap(24, 24, 24))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jOptionTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jOkButton)
                    .addComponent(jCancelButton))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBColorButtonActionPerformed
        // TODO add your handling code here:
        backgroundColor = JColorChooser.showDialog(this, "Select a color", Color.gray);
        if(backgroundColor != null)
            System.out.println("selected");
        else
            System.out.println("Unselected color");
    }//GEN-LAST:event_jBColorButtonActionPerformed

    private void jEColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEColorButtonActionPerformed
        // TODO add your handling code here:
        eventColor = JColorChooser.showDialog(this, "Select a color", Color.gray);
        if(eventColor !=null)
            System.out.println("Selected");
        else
            System.out.println("Unselected");
    }//GEN-LAST:event_jEColorButtonActionPerformed
    
    private Color getBColor(){
        if(backgroundColor!=null)
            return backgroundColor;
        else
        {
            JOptionPane.showMessageDialog(this, "Unselected background color");
            return null;
        }
    }
    
    private Color getEColor(){
        if(eventColor!=null)
            return eventColor;
        else
        {
            JOptionPane.showMessageDialog(this, "Unselected event color");
            return null;
        }
    }
    
    private void jOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jOkButtonActionPerformed
        // TODO add your handling code here:
        if(getBColor()!=null)
        {
            
        }
        if(getEColor()!=null)
        {
            
        }
        if(jNormalComboBox.getSelectedItem()!=null){
            
        }
        if(jSendComboBox.getSelectedItem()!=null){
            
        }
        if(jReceiveComboBox.getSelectedItem()!=null)
        {
            
        }
        if(jBroadcastComboBox.getSelectedItem()!=null)
        {
            
        }
        if(jForwardComboBox.getSelectedItem()!=null){
            
        }
        if(jMeassageComboBox.getSelectedItem()!=null){
            
        }
    }//GEN-LAST:event_jOkButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ViewOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ViewOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ViewOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ViewOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ViewOption().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBColorButton;
    private javax.swing.JLabel jBackgroundLabel;
    private javax.swing.JComboBox jBroadcastComboBox;
    private javax.swing.JLabel jBroadcastLabel;
    private javax.swing.JButton jCancelButton;
    private javax.swing.JLabel jColorLabel;
    private javax.swing.JButton jEColorButton;
    private javax.swing.JPanel jEventTab;
    private javax.swing.JComboBox jForwardComboBox;
    private javax.swing.JLabel jForwardLabel;
    private javax.swing.JPanel jGeneralTab;
    private javax.swing.JComboBox jMeassageComboBox;
    private javax.swing.JLabel jMeassageLabel;
    private javax.swing.JPanel jNodeTab;
    private javax.swing.JComboBox jNormalComboBox;
    private javax.swing.JLabel jNormalLabel;
    private javax.swing.JButton jOkButton;
    private javax.swing.JTabbedPane jOptionTabbedPane;
    private javax.swing.JComboBox jReceiveComboBox;
    private javax.swing.JLabel jReceiveLabel;
    private javax.swing.JComboBox jSendComboBox;
    private javax.swing.JLabel jSendLabel;
    // End of variables declaration//GEN-END:variables
}
